<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!doctype html>
<html>
	<head>
		<base href="<%=basePath%>" />
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<link rel="stylesheet" href="layui/css/layui.css" media="all"> <!-- 适应所有设备 -->
		<style type="text/css">
		</style>
	</head>
	<% String nowDay = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); %>
	<body>

		<br />
		<div class="tpl-portlet-input tpl-fz-ml" style="float: left;">
			<!-- 通过form id来调用js里ajax,来实现参数的传递 -->
			<form class="layui-form" onsubmit='return false'>
				<!-- 返回所有玩家信息 -->
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input type="text" name="playerID" id="playerID" placeholder="玩家ID" autocomplete="off" class="layui-input">
					</div>
					
					<div class="layui-inline">
						<div class="layui-input-inline">
							<button class="layui-btn layui-btn-normal" data-type="reload" id="SelectOrder" lay-filter="SelectOrder">搜索</button>
						</div>
					</div>
				</div>
			</form>
		</div>
		</div>
		
		<table lay-filter="PlayerShow" id="PlayerShow" class="layui-table">

		<script src="js/jquery.min.js"></script>
		<script src="layui/layui.js"></script>
		<script src="js/personal/formsubmit.js"></script>
		<script type="text/javascript">

			layui.use(['form', 'layer', 'table'], function() {
			var form = layui.form;
			var layer = layui.layer;
			var table = layui.table;

				layer.config({
					extend: 'MySkin/style.css'
				});
				/* table.init('PlayerShow'); */
				
  var tableIns = table.render({
					elem:'#PlayerShow',
					url:'agent/Record',
					method:'post',
					page:true,
					autoSort: false,
					even:true,
					cellMinWidth:40,
					id:'AllTable',
					request:{
						pageName:'pageIndex',
						limitName:'pageCount'
					},
					where:{
						UserId : $('#playerID').val(),
					},
					cols:[[
						{field:'UserId',title:'ID'},
						{field:'Nickname',title:'昵称'},
						{field:'CreateTime',title:'兑换时间'}
						]],
						response:{
							statusCode : 200
						},
						parseData:function(res){
							return{
								"code":res.status,
								"msg":res.message,
								"count":res.count,
								"data":res.data
							};
						}
				});
                
				
				//表格重载
				var active = {
						reload:function(){
							table.reload('AllTable',{
								page:{
									cuur:1
								},
								where:{
									UserId:$('#playerID').val(),
								}
							});
							return false;
						}
				};
				$('#SelectOrder').on('click',
				        function(){
				            var type = $(this).data('type');
				            active[type] ? active[type].call(this) : '';
				        });
				
				//按照当前的状态重载
				setInterval(function(){
	              	table.reload('AllTable', {});
	              },60000);
				
			});
		</script>

	</body>
</html>
